<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Converter</title>
    </h:head>
    <h:body>
        <h1>Welcome to the Converter</h1>

        <h3>Converter</h3>
        <p>
            <h:form>
                <h:outputLabel for="amount"   value="Amount: "/>
                <h:inputText id="amount" value="#{converterManager.amount}" required="true" requiredMessage="#{converterManager.errorCurrencyEmpty()}">
                    <f:validateDoubleRange minimum="0"/>
                </h:inputText>
                <br />
                    <h:message for="amount"/>
                <br/>

                <h:outputLabel for="from"   value="From: "/>
                <h:selectOneListbox id="from2" size="1" value="#{converterManager.from}">
                    <f:selectItems id="sisfrom" value="#{converterManager.storedCurrencies}" />
                </h:selectOneListbox>
                <br/>

                <h:outputLabel for="to"   value="To: "/>
                <h:selectOneListbox id="to" size="1" value="#{converterManager.to}">
                    <f:selectItems id="sisto" value="#{converterManager.storedCurrencies}" />
                </h:selectOneListbox>
                <br/>

                <h:commandButton value="Convert" action="#{converterManager.convert}"/>
            </h:form>
            <h:outputText rendered="#{converterManager.converted != -1}"  value="Converted: #{converterManager.converted}"/>
        </p>
    </h:body>
</html>

